using UnityEngine;

namespace Script.StateMachine
{
    public class DeathState:IState
    {
        private FSM manager;
        private Parameter _parameter;
        private AnimatorStateInfo _info;
        
        public DeathState(FSM manager)
        {
            this.manager = manager;
            _parameter = manager.parameter;
        }

        public void OnEnter()
        {
            manager.animator.Play("Dead");
        }
        public void OnUpdate()
        {
            _info = manager.animator.GetCurrentAnimatorStateInfo(0);
            if (_info.normalizedTime>0.95)
            {
                GameObject.Destroy(manager.gameObject);
            }

        }
        public void OnExit()
        {
        }
    }
}